package com.udaos.modules.product.services;

import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;

import com.udaos.common.base.Service;
import com.udaos.models.product.Ud_pay_settings;

@IocBean(args = {"refer:dao"})
public class UdPaySettingsService extends Service<Ud_pay_settings>{

	public UdPaySettingsService(Dao dao) {
		super(dao);
	}

	/**
	 * 初始化首页
	 * @param length
	 * @param start
	 * @param draw
	 */
	public NutMap init(int length, int start, int draw) {
		
		String sqls="SELECT s.id AS id,s.app_scene AS app_scene, c.name AS company_name,t.name AS account_name,p.name AS product_name,t.config AS config,tc.cc_name AS account_company "+
				   " FROM ud_pay_settings s,ud_account t,ud_company  c,ud_product_type  p,(SELECT cc.name AS cc_name,tt.id AS tt_id FROM ud_account tt,ud_company  cc WHERE tt.company_id=cc.id) tc "+
				   " WHERE s.account_id=t.id AND s.company_id=c.id AND s.product_type=p.id AND s.account_id=tc.tt_id AND s.delFlag=FALSE";
		Sql sql =Sqls.create(sqls);
		return this.data(length, start, draw, sql, sql);
		
	}
}
